#define  _CRT_SECURE_NO_WARNINGS 1
#include<stdio.h>

//环形链表
//思路一：使用数组存储地址，之后判断重复地址
//思路二：使用快慢指针和证明公式
//公式即为头结点到入环起始节点的距离等于相遇点导入环起始节点的距离
 struct ListNode {
      int val;
      struct ListNode *next;
  };
 
typedef struct ListNode ListNode;
struct ListNode* detectCycle(struct ListNode* head) {
    ListNode* slow = head;
    ListNode* fast = head;
    while (fast && fast->next)
    {
        slow = slow->next;
        fast = fast->next->next;
        if (slow == fast)
        {
            ListNode* phead = head;
            while (phead != slow)
            {
                phead = phead->next;
                slow = slow->next;
            }
            return slow;
        }
    }
    return NULL;
}
int main()
{

	return 0;
}